const treeData = [
  {
    id: 1,
    name: '技术部',
    children: [
      { pid: 1, id: 11, name: '前端技术部',
        children: [
          { pid: 11, id: 111, name: '小程序技术部' },
          { pid: 11, id: 112, name: 'Vue技术部' }
        ]
      },
      { pid: 1, id: 12, name: 'Java技术部' },
      { pid: 1, id: 13, name: 'Python技术部' }
    ]
  },
  {
    id: 2,
    name: '运营部',
    children: [
      { pid: 2, id: 21, name: '济南运营部' },
      { pid: 2, id: 22, name: '青岛运营部' }
    ]
  },
  { id: 3, name: '行政部' }
]
function delChildList(tree) {
  const arr = []
  tree.forEach(item => {
    if (item.children) {
      const children = delChildList(item.children)
      delete item.children
      arr.push(item, ...children)
    } else {
      arr.push(item)
    }
  })
  return arr
}
console.log(delChildList(treeData))
